import axios from '../../axios/api'
import React, { useEffect, useState } from 'react'
import { useParams } from 'react-router-dom'

function Detail() {
    const { id } = useParams()

    const [data, setData] = useState({})
    const getData = async () => {
        const res = await axios.get('/api/list/detail', { params: { id } })
        const { code, data } = res.data
        if (code === 200) {
            setData(data)
        }
    }
    useEffect(() => {
        getData()
    }, [])

    return (
        <div>
            <div style={{ display: 'flex' }}>
                <img style={{ width: '20vw' }} src={data.image} alt="" />
                <span>{data.title}</span>
            </div>

        </div>
    )
}

export default Detail